import request from '@/utils/request'

export function getTheses(uid, year) {
  return request({
    url: `/teachers/${uid}/theses`,
    method: 'get',
    params: {
      year
    }
  })
}

export function getTeacher(year) {
  return request({
    url: `/teachers/theses`,
    method: 'get',
    params: {
      year
    }
  })
}

export function getThesisById(id) {
  return request({
    url: `/theses/${id}`,
    method: 'get'
  })
}

export function getstuTheses(id, year) {
  return request({
    url: `/students/${id}/theses`,
    method: 'get',
    params: {
      year
    }
  })
}
export function getThesesById(id) {
  return request({
    url: `/theses/${id}`,
    method: 'get'
  })
}
export function getstuToTheses(sid, year, page, limit) {
  return request({
    url: `/students/${sid}/theses`,
    method: 'get',
    params: {
      year,
      chosen: false,
      page,
      limit
    }
  })
}
export function choseTheses(sid, uid) {
  return request({
    url: `/students/${sid}/theses/${uid}`,
    method: 'post'
  })
}
export function deleteTheses(sid, uid) {
  return request({
    url: `/students/${sid}/theses/${uid}`,
    method: 'delete'
  })
}

export function postTheses(thesis){
  return request({
    url: `/theses`,
    method: 'post',
    params: thesis
  })
}

export function putTheses(thesis,id){
  return request({
    url: `/theses/${id}`,
    method: 'put',
    params: thesis
  })
}

export function deleteTheses2(id){
  return request({
    url: `/theses/${id}`,
    method: 'DELETE',
  })
}

export function choseStudent(id,sid){
  return request({
    url: `/theses/${id}/students/${sid}`,
    method: 'post',
  })
}